<style type="text/css">
    .matrix-lable-left {
        text-align-last: left
    }

    .add-need-panel .matrix-div-left {
        width: 50px;
        float: left;
        padding-top: 7px;
    }

    .add-need-panel .matrix-div-right {
        margin-left: 50px;
    }

    .add-need-panel .bootstrap-touchspin {
        width: 90%;
    }
    .matrix-rzslider-title {
        margin-top: 16px;
    }
</style>
<accordion ng-if="isVisible">
    <accordion-group is-open="Opendepartment" is-disabled="isDisabled">
        <accordion-heading>
            部门评审
            <i class="pull-right fa fa-angle-right"
               ng-class="{'fa-angle-down': Opendepartment, 'fa-angle-right': !Opendepartment}"></i>
            <i class="fa fa-edit" ng-click="deptEdit()" title="编辑"
               ng-if="isCommited&&isAdmin"></i>
        </accordion-heading>





        <!--可编辑模块-->
        <div class="col-sm-12 form-horizontal" ng-if="!isCommited">
            <div class="form-group matrix-lable-left">
                <label class="col-sm-1 control-label" >评&nbsp;&nbsp;定&nbsp;&nbsp;人 <span style="color: red;">*</span>：</label>
                <div class="col-sm-2">
                    <m-ui-select prompt="请选择评定人" itme-list="$ctrl.userList"
                                 selected-item="$ctrl.need.sltDepartment"
                                 has-disabled="isdepartAble">
                    </m-ui-select>
                </div>
                <div class="col-sm-1"></div>
            </div>
            <div class="form-group matrix-lable-left">
                <label class="col-sm-1 control-label matrix-rzslider-title" >优&nbsp;&nbsp;先&nbsp;&nbsp;级：</label>
                <div class="col-sm-2">
                    <winit-priority-rzslider data="$ctrl.need.deptPriority" is-disabled="isdepartAble"></winit-priority-rzslider>
                </div>
            </div>
            <div class="form-group matrix-lable-left">
                <label class="col-sm-1 control-label" >需要培训：</label>
                <div class="col-sm-8">
                    <label class="i-switch m-t-xs m-r">
                        <input type="checkbox" ng-change="changeSwitch($ctrl.need.departmentTrain)"
                               ng-model="$ctrl.need.departmentTrain" ng-disabled="isdepartAble"><i></i>
                    </label>
                </div>
            </div>
            <div class="form-group matrix-lable-left" style="margin-top: 10px;">
                <label class="col-sm-1 control-label" for="req-desc">需求目的 <span style="color: red;">*</span>：</label>
                <div class="col-sm-8" style="margin-top: 5px;">
                    <span ng-repeat="obj in $ctrl.info.objectives">
                        <label ng-class="obj.check ? 'btn btn-info btn-sm btn-rounded' : 'btn btn-default btn-sm btn-rounded'"
                               ng-model="obj.check" ng-click="selecObjective(obj)" uib-btn-checkbox ng-disabled="isdepartAble">{{obj.value}}</label>
                    </span>
                    <input type="text" placeholder="请输入..." ng-show="$ctrl.need.showObjItem" ng-model="$ctrl.need.sltItemValue" style="padding: 5px; border: 1px solid #cfdadd;">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-1 control-label"><h4>价值预估</h4></label>
            </div>
            <div class="form-group">
                <label class="col-sm-1 control-label matrix-rzslider-title i-checks i-checks-sm" >
                    <input type="checkbox" ng-checked="$ctrl.need.lossPrevent.isChecked"
                           ng-model="$ctrl.need.lossPrevent.isChecked"
                           ng-disabled="isdepartAble||lossAble"
                           ng-click="lossPrevent($ctrl.need.lossPrevent)"
                    >
                    <i></i>
                    预防损失：
                </label>
                <div class="col-sm-8">
                    <winit-cycle-rzslider data="$ctrl.need.reduceLoss" is-disabled="isdepartAble"></winit-cycle-rzslider>
                </div>
                <label class="col-sm-1 control-label">万元/年</label>
            </div>
            <div class="form-group">
                <label class="col-sm-1 control-label matrix-rzslider-title i-checks i-checks-sm" >
                    <input type="checkbox" ng-checked="$ctrl.need.mayProfit.isChecked"
                           ng-model="$ctrl.need.mayProfit.isChecked"
                           ng-click="mayProfit($ctrl.need.mayProfit)"
                           ng-disabled="isdepartAble||profitAble"
                    >
                    <i></i>
                    可能盈利：
                </label>
                <div class="col-sm-8">
                    <winit-cycle-rzslider data="$ctrl.need.profit"
                                          is-disabled="isdepartAble"
                    ></winit-cycle-rzslider>
                </div>
                <label class="col-sm-1 control-label">万元/年</label>
            </div>

            <div class="form-group">
                <label class="col-sm-1 control-label matrix-rzslider-title i-checks i-checks-sm" >
                    <input type="checkbox" ng-checked="$ctrl.need.saveCost.isChecked"
                           ng-model="$ctrl.need.saveCost.isChecked"
                           ng-click="saveCostClick($ctrl.need.saveCost)"
                           ng-disabled="isdepartAble||saveAble"
                    >
                    <i></i>
                    节省成本：
                </label>
            </div>
            <div class="form-group">
                <div class="col-sm-1"></div>
                <div class="col-sm-11 control-label">
                    <div class="col-sm-12" ng-repeat="i in $ctrl.need.expectLowerCostList" ng-if="i.isDel==undefined || !i.isDel">
                        <div class="col-sm-2">
                            <div class="matrix-div-left">可以让</div>
                            <div class="matrix-div-right">
                                <winit-text-number number-data="i.userNum" number-max="100" is-disabled="isdepartAble"></winit-text-number>
                            </div>
                        </div>
                    <div class="col-sm-3">
                        <div class="matrix-div-left">名</div>
                        <div class="matrix-div-right">
                            <select class="input-sm form-control inline v-middle" ng-model="i.role" ng-disabled="isdepartAble">
                                <option value="customer">客服专员</option>
                                <option value="houser">仓库专员</option>
                                <option value="pdm">PDM</option>
                                <option value="dev">开发</option>
                                <option value="qa">测试</option>
                                <option value="qa">测试</option>
                                <option value="ops">运维</option>
                                <option value="pd">产品</option>
                                <option value="manager">经理</option>
                            </select>
                        </div>
                    </div>
                    <div class="col-sm-2">
                        <div class="matrix-div-left">每</div>
                        <div class="matrix-div-right">
                            <select class="input-sm form-control inline v-middle" ng-model="i.cycle" ng-disabled="isdepartAble">
                                <option value="d">天</option>
                                <option value="w">周</option>
                                <option value="m">月</option>
                            </select>
                        </div>
                    </div>
                    <div class="col-sm-2">
                        <div class="matrix-div-left">节省</div>
                        <div class="matrix-div-right">
                            <winit-text-number number-data="i.hours" number-max="100" is-disabled="isdepartAble"></winit-text-number>
                        </div>
                    </div>
                    <div class="col-sm-1">
                        <div class="matrix-div-left">个小时</div>
                    </div>
                        <i class="fa fa-plus-square-o" style="cursor: pointer; font-size: 25px;" ng-click="addLowerCost();"
                           ng-if="!isdepartAble"></i>
                        &nbsp;&nbsp;&nbsp;&nbsp;
                        <i class="fa fa-trash" style="cursor: pointer; font-size: 25px;" ng-click="delLowerCost(i);"
                           ng-if="!isdepartAble&&$ctrl.need.expectLowerCostList.indexOf(i)>0"
                        ></i>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-1 control-label">参考价值：</label>
                <label class="col-sm-2 control-label"><span style="color: red;" ng-bind="getLowerValue()"></span> 万元/年</label>
            </div>

            <div class="form-group" >
                    <label class="col-sm-3  matrix-rzslider-title i-checks i-checks-sm" ng-if="!isCommited">
                        <input type="checkbox" ng-checked="$ctrl.info.isEnded"
                               ng-model="$ctrl.info.isEnded"
                               ng-click="prepareCommit($ctrl.info.isEnded)"
                               style="font-size: small"
                        >
                        <i></i>
                       作为需求部门评审人我已经完成评审
                    </label>

                <button class="btn btn-default "
                        ng-click="departmentAffirm()"
                        ng-if="!isCommited"
                        ng-disabled="!$ctrl.info.isEnded"
                >
                    评审完成</button>

            </div>
        </div>



        <!--只读模块-->

        <div class="col-sm-12 form-horizontal" ng-if="isCommited">
            <div class="form-group matrix-lable-left">
                <label class="col-sm-1 control-label" >评&nbsp;&nbsp;定&nbsp;&nbsp;人：</label>
                <label class=" control-label" >{{$ctrl.need.sltDepartment.crtname}}</label>
            </div>
            <div class="form-group matrix-lable-left">
                <label class="col-sm-1 control-label"  >优&nbsp;&nbsp;先&nbsp;&nbsp;级：</label>
                <label class=" control-label" >{{$ctrl.need.deptPriorityStr}}</label>
            </div>
            <div class="form-group matrix-lable-left">
                <label class="col-sm-1 control-label" >需要培训：</label>
                <label class=" control-label" >{{$ctrl.need.departmentTrain=="1"?"是":"否"}}</label>
            </div>
            <div class="form-group matrix-lable-left" style="margin-top: 10px;">
                <label class="col-sm-1 control-label" for="req-desc">需求目的：</label>
                <label class=" control-label" >{{$ctrl.need.purposeStr}}{{}}</label>
            </div>
            <!--<div class="form-group">-->
                <!--<label class="col-sm-1 control-label"><h4>价值预估</h4></label>-->
            <!--</div>-->
            <div class="form-group">
                <label class="col-sm-1 control-label  ">预防损失：</label>
                <label class=" control-label">{{$ctrl.need.reduceLoss}}万元/年</label>
            </div>
            <div class="form-group">
                <label class="col-sm-1 control-label  ">可能盈利：</label>
                <label class=" control-label">{{$ctrl.need.profit}}万元/年</label>
            </div>

            <div class="form-group">
                <label class="col-sm-1 control-label  ">节省成本：</label>
                <div class="col-sm-11 ">
                    <div class=" control-label " ng-repeat="i in $ctrl.need.expectLowerCostList">
                        <label>可以让</label>
                        <label>{{i.userNum}}</label>
                        <label>名</label>
                        <label>{{i.roleName}}</label>
                        <label>每</label>
                        <label>{{i.cycleName}}</label>
                        <label>节省</label>
                        <label>{{i.hours}}</label>
                        <label>个小时</label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-1 control-label">参考价值：</label>
                <label class=" control-label">{{$ctrl.need.deptRefValue}} 万元/年</label>
            </div>
        </div>
    </accordion-group>
</accordion>